package com.bright.hxj.cwduijie.repository;

import com.bright.hxj.cwduijie.pojo.po.FixedAssetsHandleLog;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface FixedAssetsHandleLogRepository extends JpaRepository<FixedAssetsHandleLog, Integer>, JpaSpecificationExecutor<FixedAssetsHandleLog> {

    List<FixedAssetsHandleLog> getBySjjhbz(int sjjhbz);

    @Query("select TYSHXYDM from FixedAssetsHandleLog where sjjhbz=:sjjhbz group by TYSHXYDM")
    List<String> getDistinctTYSHXYDMBySjjhbz(@Param("sjjhbz") int sjjhbz);

    @Query("from FixedAssetsHandleLog where sjjhbz=:sjjhbz and ZT_DATA_KEY like :ztDataKey%")
    List<FixedAssetsHandleLog> getBySjjhbzAndZtDataKey(@Param("sjjhbz") int sjjhbz, @Param("ztDataKey") String ztDataKey);

    @Query("select KJQJ from FixedAssetsHandleLog where ZT_DATA_KEY=:ztDataKey and sjjhbz in (:sjjhbz) group by KJQJ")
    List<String> getDistinctKJQJByZtDataKeyAndSjjhbz(@Param("ztDataKey") String ztDataKey, @Param("sjjhbz") List<Integer> sjjhbz);

    @Query("from FixedAssetsHandleLog where sjjhbz in (:sjjhbz) and ZT_DATA_KEY=:ztDataKey and KJQJ=:yearMonth")
    List<FixedAssetsHandleLog> getBySjjhbzAndZTDATAKEYAndSSQJ(@Param("sjjhbz") List<Integer> sjjhbz, @Param("ztDataKey") String ztDataKey, @Param("yearMonth") String yearMonth);

}